tdf#122171 block closing final window while xslt filter dialog is modal
Change-Id: Ic40d4074bad7c06d1c1e395de74442f2a3bca5cd
Reviewed-on: https://gerrit.libreoffice.org/65419
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
index 9b5dd73..2f35661 100644
--- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
+++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx
@@ -249,24 +249,20 @@
void SAL_CALL XMLFilterDialogComponent::queryTermination( const EventObject& /* Event */ )
{
::SolarMutexGuard aGuard;
if (!mpDialog)
return;
// we will never give a veto here
if (!mpDialog->isClosable())
{
mpDialog->ToTop();
throw TerminationVetoException(
"The office cannot be closed while the XMLFilterDialog is running",
static_cast<XTerminateListener*>(this));
}
else
mpDialog->Close();
mpDialog->ToTop();
}
void SAL_CALL XMLFilterDialogComponent::notifyTermination( const EventObject& /* Event */ )
{
{
::SolarMutexGuard aGuard;
if (!mpDialog)
return;
mpDialog->Close();
}
// we are going down, so dispose us!
dispose();
}
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 5ae9094..39b3dfe 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -18,17 +18,19 @@
*/
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <unotools/resmgr.hxx>
#include <tools/urlobj.hxx>
#include <vcl/headbar.hxx>
#include <unotools/streamwrap.hxx>
#include <unotools/closeveto.hxx>
#include <unotools/pathoptions.hxx>
#include <unotools/resmgr.hxx>
#include <unotools/streamwrap.hxx>
#include <osl/file.hxx>
#include <o3tl/enumrange.hxx>
#include <vcl/builderfactory.hxx>
@@ -70,7 +72,6 @@
Dialog::InitFlag eFlag)
: ModelessDialog(pParent, "XMLFilterSettingsDialog", "filter/ui/xmlfiltersettings.ui", eFlag)
, mxContext( rxContext )
, m_bIsClosable(true)
, m_sTemplatePath("$(user)/template/")
, m_sDocTypePrefix("doctype:")
{
@@ -134,7 +135,11 @@
IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, Button *, pButton, void )
{
m_bIsClosable = false;
// tdf#122171 block closing libreoffice until the following dialog
// is dismissed
css::uno::Reference<css::frame::XDesktop2> xDesktop(css::frame::Desktop::create(mxContext));
css::uno::Reference<css::frame::XFrame> xFrame(xDesktop->getCurrentFrame());
utl::CloseVeto aKeepDoc(xFrame);
if (m_pPBNew == pButton)
{
@@ -164,8 +169,6 @@
{
Close();
}
m_bIsClosable = true;
}
IMPL_LINK_NOARG(XMLFilterSettingsDialog, SelectionChangedHdl_Impl, SvTreeListBox*, void)
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
index ff55a19..d6933da 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -105,8 +105,6 @@
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
bool isClosable() { return m_bIsClosable;}
private:
void initFilterList();
void disposeFilterList();
@@ -135,8 +133,6 @@
VclPtr<PushButton> m_pPBOpen;
VclPtr<CloseButton> m_pPBClose;
bool m_bIsClosable;
OUString m_sTemplatePath;
OUString m_sDocTypePrefix;